package edu.washington.vaccine.ui;

import android.app.ActivityGroup;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

/*
 * Functions as the persistent activity that manages
 * vaccine lists and data on the Vaccine Tab
 * 
 */
public class VaccineGroupActivity extends ActivityGroup {

	Context context;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.context = this;
		
		Intent i = new Intent(context, VaccineListActivity.class);
		replaceContentView("searchVaccine", i);
	}

	public void replaceContentView(String id, Intent newIntent) {
		View view = getLocalActivityManager().startActivity(id, newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView();
		this.setContentView(view);
	}
	
    @Override
	public void onBackPressed() {
		Intent i = new Intent(this, VaccineListActivity.class);
		this.replaceContentView("nextactivity", i);
	}
}
